// #include"./tinyxml2-master/tinyxml2.h"
// #include"./tinyxml2-master/tinyxml2.cpp"
// #include<iostream>
// #include<vector>
#include"xmlCreate.cpp"
#include"spPrReader.cpp"
#include"txBodyReader.cpp"
#include"spWriter.cpp"
#include"cxnSpspPrWriter.cpp"

ShapePro* spPrReader(tinyxml2::XMLElement *node);
TextFrame* txBodyReader(tinyxml2::XMLElement *node);
void spWriter(ShapePro* my_ShapePro, TextFrame *m_text_frame);

int main(){
    vector<ShapePro*> vec_spPr;
    vector<TextFrame*> vec_txBody;
    vector<ShapePro*> vec_txBody1;
    tinyxml2::XMLDocument doc;
    doc.LoadFile( "./ppt/455/ppt/slides/slide1.xml");

    tinyxml2::XMLElement *rootElement = doc.RootElement();
    tinyxml2::XMLElement *cSld = rootElement->FirstChildElement();
    tinyxml2::XMLElement *spTree = cSld->FirstChildElement();
    tinyxml2::XMLElement *sp = spTree->FirstChildElement("p:sp");
    while(sp){
        ShapePro* spPr2 = spPrReader(sp);
        vec_spPr.push_back(spPr2);

        TextFrame* txBody2 = txBodyReader(sp);
        vec_txBody.push_back(txBody2);

        sp = sp->NextSiblingElement("p:sp");
        // sp = sp->NextSiblingElement("p:cxnSp");
    }

    tinyxml2::XMLElement *cxnSp = spTree->FirstChildElement("p:cxnSp");
    while(cxnSp){
        ShapePro* spPr2 = spPrReader(cxnSp);
        vec_txBody1.push_back(spPr2);
        cxnSp = cxnSp->NextSiblingElement("p:cxnSp");
    }

    xmlCreate();

    int size = vec_spPr.size();
    for (int i = 0; i < size; i++){
        spWriter(vec_spPr[i], vec_txBody[i]);
    }

    int size0 = vec_txBody1.size();
    for (int i = 0; i < size0; i++){
        cxnSpspPrWriter(vec_txBody1[i]);
    }

    return 0;
}